<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./css/addressInfo.css" />
		<script type="text/javascript" src="js/jquery.js"></script>
		<script type="text/javascript" src="js/addressInfo.js"></script>
	</head>
	<body>
		
		<script>
			$.ajax({
			    type: "GET",
			    url: "http://localhost:8080/mall/findAlladdress",
			    dataType: "json",
			    success: function(data){
			        // console.log(data.message)
					data = data.message;
					str=""
					for (let i=0 ; i<data.length;i++) {
						str+=`
							<tr>
								<td class="p-name">${data[i].name}</td>
								<td class="p-address">${data[i].address}</td>
								<td class="p-tel">${data[i].tel}</td>
								<td class="p-action">
									
									<button class="edit" id="${data[i].id}">编辑</button>
									<button class="del" id="${data[i].id}">删除</button></td>
							</tr>
						`
					}
					
					$("tbody").html(str)
					
					
				}
			   });
		</script>


		<div id="addressInfo">
			<div class="shou">
				<span class="title">收货地址</span>
				<div class="btn-area">添加收货地址</div>
			</div>
			<div class="table">
				<table>
					<thead>
						<tr>
							<th class="t-name">用户名</th>
							<th class="t-address">详细地址</th>
							<th class="t-tel">联系电话</th>
							<th class="t-action">操作</th>
						</tr>
					</thead>
					<tbody>
						<!-- <tr>
							<td>用户名</td>
							<td>详细地址</td>
							<td>联系电话</td>
							<td>
								<a class="layui-btn layui-btn-xs" >设为默认地址</a>
								<a class="layui-btn layui-btn-xs"  class="edit">编辑</a>
								<a class="layui-btn layui-btn-danger layui-btn-xs" class="del">删除</a></td>
						</tr> -->
					</tbody>
				
				</table>
				
				
			</div>
		</div>

		
		<form class="someinfo">
			<div class="in">
				<div class="info">
					<input type="text" name="title" placeholder="收货人姓名" class="sname">
				</div>
				<div class="info">
					<input type="text" name="title" class="saddress" placeholder="收货地址">
				</div>
				<div class="info">
					<input type="text" name="title" class="sphone" placeholder="手机号码">
				</div>
				<!-- <div class="check">
					<input type="checkbox"> 设为默认地址
					<!-- <input type="checkbox"  title="设为默认地址"> -->
				<!-- </div> --> 
				<div class="info">
					<!-- <button class="save" style="width: 40%; border-radius: 50px;">保存信息</button> -->
					<button type="button" class="save" lay-submit="" lay-filter="demo1" id="">立即提交</button>

				</div>
			</div>
		</form>

		
		<!-- <script type="text/html" id="barDemo">
			<a class="layui-btn layui-btn-xs" lay-event="set">设为默认地址</a>
			<a class="layui-btn layui-btn-xs" lay-event="edit" class="edit">编辑</a>
		<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" class="del">删除</a>
		</script> -->
		<!-- 		<script type="text/javascript">
			layui.use(['element', 'jquery', 'layer', 'table'], function() {
				var table = layui.table;
				var $ = layui.jquery;
				$.ajax({
					success: function() {
						table.render({
							elem: '#test',
							url: 'http://localhost:8080/mall_war_exploded//findAlladdress',
							skin: 'nob',
							data: [{
								// "name":"zs",
								// "address":"广西南宁",
								// "tel":"214123413"
							}],
							cols: [
								[{
										field: 'name',
										title: '用户名',
										width: '15%'
									}, {
										field: 'address',
										title: '详细地址',
										width: '35%'
									}, {
										field: 'tel',
										title: '联系电话',
										width: '35%'
									}, {
										fixed: 'right',
										title: '操作',
										toolbar: '#barDemo',
										width: '30%'
									}
		
								]
							],
							id: 'testReload',
							limit: 10,
							parseData: function(res) {
								// console.log(res.message)
								return {
									"code": 0,
									"msg": "",
									"count": 1000,
									"data": res.message
								}
							}
							// ,page: true
						});
					}
				})
		
		
			})
		</script> -->
		
		
		


	</body>
</html>
